import * as Cesium from 'cesium';

class FlexBox {
  constructor(viewer) {
    this.viewer = viewer;
    this.createFlexBox();
  }

  // 创建flexbox
  createFlexBox () {
    const geometry1 = new Cesium.BoxGeometry({
      maximum: new Cesium.Cartesian3(700000.0, 700000.0, 700000.0),
      minimum: new Cesium.Cartesian3(0.0, 0.0, 0.0),
    });
    this.viewer.scene.primitives.add(new Cesium.Primitive({
      geometryInstances: new Cesium.GeometryInstance({
        geometry: geometry1,
        modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(110, 40.03883)),
      }),
      appearance: new Cesium.MaterialAppearance({
        material: new Cesium.Material({
          fabric: {
            type: 'Color',
            uniforms: {
              color: new Cesium.Color(1.0, 0.0, 0.0, 0.1),
            },
          },
        }),
        faceForward: true,
      }),
      asynchronous: false,
    }));
  }
}

export default FlexBox;
